package 
{
	import asunit.textui.TestRunner;
	import flash.display.Sprite;
	import flash.events.Event;
	import screen.GameScreen;
	import test.TestAll;
	
	/**
	 * ...
	 * @author Jeroen Gildemacher
	 */
	public class Main extends Sprite 
	{
		[Embed(source = '../lib/landscape.png')] 
		public static var landscapePNG:Class;
		[Embed(source = '../lib/sky.png')] 
		public static var skyPNG:Class;
		
		private var gameScreen:GameScreen;
		public function Main()
		{
			
			gameScreen = new GameScreen;
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			
			//enable unit testing
			//var unitTests:TestRunner = new TestRunner();
			//stage.addChild(unitTests);
			//unitTests.start(test.TestAll, null, TestRunner.SHOW_TRACE);
			
			
			removeEventListener(Event.ADDED_TO_STAGE, init);
			//entry point
			addChild(gameScreen);
			gameScreen.init();
			addEventListener(Event.ENTER_FRAME, gameScreen.drawScreen);
			
		}
		
	}
	
}